/**
 * @param {character[][]} board
 * @param {number} rMove
 * @param {number} cMove
 * @param {character} color
 * @return {boolean}
 */
 var checkMove = function(board, rMove, cMove, color) {
  const m = board.length, n = board[0].length
  board[rMove][cMove] = color
  const directions = [[-1,0], [1,0], [0,1], [0,-1], [-1,1], [-1,-1], [1,1], [1,-1]]
  const dfs = (i, j, dir, cnt) => {
    const [dx, dy] = dir
    const x = i+dx, y = j+dy
    if(x >= 0 && x < m && y >= 0 && y < n && board[x][y] !== '.'){
      if(board[x][y] === color){
        flag = cnt >= 1
        return cnt >= 1
      }
      return dfs(x, y, dir, cnt+1)
    }
    return false
  }
  for(const dir of directions){
    if(dfs(rMove, cMove, dir, 0)){
      return true
    }
  }
  return false
};